<?php include_once './application/views/sys_admin/common/header.php';  ?>
<!-- admin_main -->
<div class="admin_main">
	<!-- Admin_top end -->
	<?php include_once './application/views/sys_admin/common/borrow_left.php';  ?>
	<?php 
	$borrow_status = array(
		0=>'所有',
		1=>'未审核',
		2=>'审核通过',
		3=>'已满标',
		4=>'已还完',
		5=>'取消',
	);
	?>
	<!-- Admin_Left End -->
	<div class="admin_right">
		<div class="admin_right_title">
			<strong>客户管理</strong> &gt;&gt;  易居宝  &gt;&gt; 项目列表
		</div>
		
		<div class="admin_right_con" >
			<table border="0" cellspacing="1" cellpadding="0">
			  <tr style="color:#0068b7;">
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>编号</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>借款户</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>借款标题</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>借款金额</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>状态</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>添加时间</strong></td>
				<td height="35" align="center" valign="middle" bgcolor="#F1F1F1"><strong>操作</strong></td>
			  </tr>
			  <?php foreach($list as $key=>$borrow){?>
			  <tr>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $borrow['id'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $borrow['user_id'];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><a href="/sys_admin/borrow/borrow_view/<?php echo $borrow['id'];?>"><?php echo $borrow['title'];?></a></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo number_format($borrow['account'],2);?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo $borrow_status[$borrow['fstatus']];?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF"><?php echo date('Y-m-d H:i',$borrow['add_time']);?></td>
				<td height="35" align="center" valign="middle" bgcolor="#FFFFFF">
					<?php if ($borrow['fstatus']==1){?><a href="/sys_admin/yjb/verify/<?php echo $borrow['id'];?>.html">审核</a><?php }else{?>--<?php }?>
				</td>
			  </tr>
			  <?php }?>
			  <tr>
			  	<td colspan="11" align="right">
			  		<form action="/sys_admin/yjb/borrowlist/" method="get">
			  			标题：<input type="text" id="title" name="title" value="<?php echo $where['title']?>" />
			  			状态：<select id="fstatus" name="fstatus">
			  				<?php foreach($borrow_status as $status_key=>$status_value){?>
			  				<option value="<?php echo $status_key?>" <?php if($where['fstatus']==$status_key){?>selected="selected"<?php }?>><?php echo $status_value;?></option>
			  				<?php }?>
			  			</select>
			  			用户：<input type="text" id="username" name="username" value="<?php echo $where['username'];?>" />
			  			<input type="submit"/>
			  		</form>
			  	</td>
			  </tr>
			  <tr>
			  	<td colspan="12"  height="35" align="center" valign="middle" bgcolor="#FFFFFF" class="page"><?php echo $this->pagination->create_links();?></td>
			  </tr>
			</table>
			</div>
	</div>
<!-- Admin_Right End -->
</div>
<!-- admin_main end -->
<style type="text/css">
	#dialog{padding: 10px 0;width: 400px;}
	.news_add_body .line_wrap .line {float: left;padding: 5px 0;width: 100%;}
	.news_add_body .line_wrap .line .title {
		display: block;
		float: left;
		line-height: 30px;
		margin-right: 10px;
		text-align: right;
		width: 100px;
	}
	.news_add_body .line_wrap .line .context {float: left;}
	.widget_ipt_lite_wrap {
		height: 20px;
		padding: 2px 5px;
		width: 100px;
		border: 1px solid #c4c4c4;
		border-radius: 2px;
		background-color: #fff;
	}
	.widget_ipt_lite_wrap .widget_ipt_lite {
		float: left;
		margin: 0;
		padding: 0;
		width: 100px;
		height: 20px;
		line-height: 20px;
		border: none;
		color: #888;
	}
	.news_add_foot {margin-top: 20px;text-align: center;}
	.news_add_foot .widget_ipt_btn{display: inline-block;
		zoom: 1;
		height: 24px;
		line-height: 24px;
		width: 60px;
		font-size: 12px;
		text-align: center;
		cursor: pointer;
		padding: 0 10px;
		margin: 3px 5px;
		font-weight: bold;
		border: 1px solid #ccc;
	}
	.btnblue{  color:#0068b7;}
</style>
<div id="dialog" title="系统提示" style="display:none;">
<div id="msg" style="text-align:center;color:red">&nbsp;</div>
<div class="news_add_body">
	<div class="line_wrap">
		<div class="line">
			<span class="title">最低投标金额:</span>
			<div class="context">
				<div class="widget_ipt_lite_wrap" style="width: 200px;">
					<input type="text" id="lowest_account" name="lowest_account" value=""/>元
				</div>
			</div>
		</div>
		<div class="line">
			<span class="title">最高投标金额:</span>
			<div class="context">
				<div class="widget_ipt_lite_wrap" style="width: 200px;">
					<input type="text" id="most_account" name="most_account" value=""/>元
				</div>
			</div>
		</div>
		<div class="klear"></div>
	</div>
	<div class="news_add_foot">
			<input type="hidden" name="borrow_id" id="borrow_id" />
			<input type="button"  class="widget_ipt_btn btnblue" value="提交" onclick="changeAccount();" />
			<input type="button" class="widget_ipt_btn" value="关闭" onclick="$('#dialog').dialog('close');"/>
		</div>
		
</div>

</div>


<script>
function changeLimit(_this){
	$( "#dialog" ).dialog({
		height:250,
		width:500,
		modal:true, //蒙层（弹出会影响页面大小）
		title:'修改投标限额'
	});
	var _id = $(_this).attr("dataid");
	var _datamost = $(_this).attr("datamost");
	var _datalowest = $(_this).attr("datalowest");
	
	$( "#lowest_account" ).val(_datalowest);
	$( "#most_account" ).val(_datamost);
	$( "#borrow_id" ).val(_id);
	
}

function changeAccount(){
$.ajax({
		type: "POST",
		url: "/sys_admin/borrow/borrow_account",
		data: "id="+$('#borrow_id').val()+"&lowest_account="+$('#lowest_account').val()+"&most_account="+$('#most_account').val(),
		success: function(msg){
	        $( "#dialog" ).dialog();
			$("#msg").html(msg);
			setTimeout(function(){
				$("#msg").html("&nbsp;");
				if(msg=='操作成功'){
					window.location.reload();
				}
			},3000);
		},
		dataType: "text"
	});
}

function withdraw(borrow_id){
	$.ajax({
		type: "get",
		url: "/sys_admin/borrow/withdraw/"+borrow_id,
		success: function(msg){
			$("#dialog" ).dialog();
			if(msg == 1){
				$("#msg").html("撤标成功！");
				$("#chebiao_"+borrow_id).hide();
			}else{
				$("#msg").html("撤标失败，请联系管理员！");
			}
			setTimeout(function(){
				$("#dialog" ).dialog("close");
			},3000);
		},
		dataType: "text"
	});
}


function borrow_check(borrow_id){
	$.ajax({
		type: "post",
		url: "/sys_admin/yjb/borrow_yjb_check/",
		data:"id="+borrow_id,
		success: function(msg){
			if(msg == 1){
				window.location.reload();
			}
		},
		dataType: "text"
	});
	
}

</script>

</body>
</html>
